function $(id){
    return document.getElementById(id);
}
var login = $("login"),//获取点击的登录按钮
    demo = $("demo"),//获取整体半透明部分
    loginHidden = document.getElementsByClassName("login-hidden")[0],//获取隐藏的登录框
    close = $("close"),//获取关闭登录框的按钮
    register = $("register"),//获取点击的注册按钮
    registerHidden = document.getElementsByClassName("register-hidden")[0],//获取隐藏的注册框
    registerClose = $("register-close"),//获取关闭注册框的按钮
    expandText = $("expand-text"),//获取展开全文的按钮
    leftbarArticle = document.getElementsByClassName("leftbar-article")[0],
    articleBlock = document.getElementsByClassName("article-block")[0],//获取设置overflow hidden 的标签
    articleHidden = document.getElementsByClassName("article-hidden")[0],//获取隐藏的部分
    articleHide = document.getElementsByClassName("article-hide")[0];//获取遮挡的透明部分
// 点击显示登录框
login.onclick = function(){
    demo.style.display = "block";
    loginHidden.style.display = "block";
}
// 点击关闭登录框
close.onclick = function(){
    demo.style.display = "none";
    loginHidden.style.display = "none";
}
// 点击显示注册框
register.onclick = function(){
    demo.style.display = "block";
    registerHidden.style.display = "block";
}
registerClose.onclick = function(){
    demo.style.display = "none";
    registerHidden.style.display = "none";
}
//创建收起的按钮  并设置属性
var retract = document.createElement("a");
retract.style.href = "javascript:;";
retract.innerHTML = "收起∧";
retract.style.cursor = "pointer";
retract.style.float = "right";
expandText.onclick = function(){
    var _this = this;
    this.style.display = "none";
    leftbarArticle.style.height = "1998px";
    articleBlock.style.overflow = "visible";
    articleHide.style.position = "static";
    articleHidden.appendChild(retract);
    retract.onclick = function(){
        _this.style.display = "block";
        leftbarArticle.style.height = "auto";
        articleBlock.style.overflow = "hidden";
        articleHide.style.position = "absolute";
    }
}